<template>
	<view class="content">
		<view class="firstline">
			<u-row>
				<u-col span="3" >
					<view class="second-font">
						预约时间
					</view>
				</u-col>
				<u-col span="5" >
					<view class="first-font">
						{{patientinfo.consultCreateTime}}
					</view>
				</u-col>
				<u-col offset="2" span="2" >
					<view class="impotant-font">
						{{patientinfo.consultStatus}}
					</view>
				</u-col>
			</u-row>
		</view>
		<view class="secondline">
			<u-row>
				<u-col span="3" >
					<view class="second-font">
						问诊人
					</view>
				</u-col>
				<u-col offset="5" span="4" >
					<view class="first-font">
						{{patientinfo.personName}}&nbsp;&nbsp;{{patientinfo.personGenderName}}&nbsp;&nbsp;{{patientinfo.personAge}}岁
					</view>
				</u-col>
			</u-row>
		</view>
		<view class="thirdline">
			<u-row>
				<u-col span="3" >
					<view class="second-font">
						所需药品
					</view>
				</u-col>
				<u-col span="9" >
						<u-button v-for="demand in patientinfo.drugIds" type="success" shape="circle" :plain="true" size="mini" class="medicinecard">{{demand}}</u-button>
				</u-col>
			</u-row>
		</view>
		<view class="secondline">
			<u-row>
				<u-col span="3" >
					<view class="second-font">
						历史诊断
					</view>
				</u-col>
				<u-col offset="5" span="4" >
					<view class="first-font">
						{{patientinfo.diagnosis}}
					</view>
				</u-col>
			</u-row>
		</view>
		<view class="forthline">
			<u-row>
				<u-col span="3" >
					<view class="second-font">
						病情描述：
					</view>
				</u-col>
			</u-row>
			<view class="first-font forthlineword">
				{{patientinfo.question}}
			</view>
		</view>
		<view class="fifthline">
			<u-row>
				<u-col span="3" >
					<view class="second-font">
						病情图片：
					</view>
				</u-col>
			</u-row>
			<view class="uploadpic">
				<u-row>
					<u-col span="4" v-for="item in patientinfo.photoIds">
						<u-image width="200rpx" height="200rpx" :src="item" class="imageitem"></u-image>
					</u-col>
				</u-row>
			</view>
		</view>
		<view v-if="patientinfo.consultStatus=='待接诊' || patientinfo.consultStatus=='进行中'">
			<button class="bottombutton" @click="toPath()">处方</button>
		</view>
	</view>
</template>

<script>
	import tabbar from '../../component/tabbar.vue'
	export default{
		data() {
			return {
				action: '',
				patientinfo:[],
				src: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-b32b5cb2-8bc8-483a-8465-e7b67cc35291/392056bb-8388-494b-a8fb-c91c4f0e6159.jpeg'
			}
		},
		components:{
			tabbar,
		},
		methods:{
			toPath(){
				console.log(this.patientinfo.accountId)
				this.$goEasy.publish({
					channel: this.patientinfo.accountId, //替换为您自己的channel
					message: "医生"+getApp().globalData.doctorinfo.doctorName+"正在为您进行接诊" //替换为您想要发送的消息内容
				});
				uni.navigateTo({
					url:"doctor_dispensing_detail_prescription"
				})
				uni.request({
				    url: getApp().globalData.hostip+'Demo/consult/updateIng?id='+this.patientinfo.consultId, 
				    data: {
				    },
					fail:(fa) =>{
						console.log(fa)
					},
				    success: (res) => {
						console.log(res.data)
				    }
				});
			},
		},
		onLoad:function (option){
			console.log(option.id);
			var patientlist=[];
			patientlist=getApp().globalData.patientlist;
			console.log(patientlist);
			for(var i=0;i<patientlist.length;i++){
				if(patientlist[i].consultId==option.id){
					this.patientinfo=patientlist[i]
				}
			}
			// this.patientinfo=getApp().globalData.patientlist[option.id-1];
			console.log(this.patientinfo)
		}
	}
</script>

<style scopped>
	page{
		background-color: #f5f5f5;
	}
	.firstline{
		width: 100%;
		text-align: center;
		background-color: #ffffff;
	}
	.u-row{
		padding: 24rpx;
	}
	.secondline{
		margin-top: 24rpx;
		text-align: center;
		background-color: #ffffff;
	}
	.thirdline{
		margin-top: 1rpx;
		text-align: center;
		background-color: #ffffff;
	}
	.forthlineword{
		margin: 0 32rpx;
		padding-bottom: 32rpx;
	}
	.forthline{
		margin-top: 3rpx;
		background-color: #ffffff;
	}
	.fifthline{
		background-color: #ffffff;
		margin-top: 24rpx;
	}
	.uploadpic{
		margin: 0 28rpx;
	}
	.medicinecard{
		padding-right:20rpx ;
	}
	.bottombutton{
		font-size: 36rpx;
		width:100%;
		position:fixed;
		bottom:0;
		color: #FFFFFF;
		background-color:#1477fe;
		border-radius: 0;
	}
/* 	.imageitem{
		display: inline-block;
		margin-right: 20rpx;
	} */
</style>
